UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xSe9gfPqa6Q3YIrCE826kOlJ7PREPeA2VCVa69Q8GaE=' 
WHERE 
  key_id = '15f833af20bc72ad917f61be3685c0942e61a2a58d49beeef2e43f0ace3e37be' 
  AND (
    token = 'xSe9gfPqa6Q3YIrCE826kOlJ7PREPeA2VCVa69Q8GaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037