UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nE415Nhy+7LxwoH13jkiVxcRGLfj8POab0VZ7vRreco=' 
WHERE 
  key_id = 'af4db314e6136d318c98dca0ec0174f0f42b04ad753620e5fc7824ca6c9646a9' 
  AND (
    token = 'nE415Nhy+7LxwoH13jkiVxcRGLfj8POab0VZ7vRreco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046