UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MS3embHlS8a+PmytkQw5UarUymbvCUvJNM1hdtBJvyg=' 
WHERE 
  key_id = '9bae05a24747c494c845d80189b0d3ce3fa141e431142aaf582ba69631ea5a74' 
  AND (
    token = 'MS3embHlS8a+PmytkQw5UarUymbvCUvJNM1hdtBJvyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041