UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd4iKJE1Zh9QaGRqAAClCi8FiXXOmjTLfo94mWTEPc88=' 
WHERE 
  key_id = '447658a1da974c1978fd335621de2690f114017e587692235b7f58194539cebd' 
  AND (
    token = 'd4iKJE1Zh9QaGRqAAClCi8FiXXOmjTLfo94mWTEPc88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027