UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4d5fhDbQak646RIbqTrouA2suaALk71qYF/3lwnON4k=' 
WHERE 
  key_id = 'f94d453b0a9551007d0cb18638a1e5554bec4973819b833a11325034171a5da6' 
  AND (
    token = '4d5fhDbQak646RIbqTrouA2suaALk71qYF/3lwnON4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040