UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYQzAiGSngEx6QD2KkTLhvxhNwoGOZgoyZCBEiay5VA=' 
WHERE 
  key_id = '14b9cdb9eb5154fd9073c446de451aed70480f241dc8c63074e338804b631666' 
  AND (
    token = 'cYQzAiGSngEx6QD2KkTLhvxhNwoGOZgoyZCBEiay5VA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025