UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'snoewepK0Z4tW1oxtVvvQnJoTcMZPi27yf8qsdaKEP8=' 
WHERE 
  key_id = '3fd1e1041d4c59ecb0f2d191ec94787fc13f182f19b493a4a5eded5090ffd634' 
  AND (
    token = 'snoewepK0Z4tW1oxtVvvQnJoTcMZPi27yf8qsdaKEP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038