UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GG9ErRoVohjfGFoxrA8p8VLRUMMibMNZnSCKQBD8+8o=' 
WHERE 
  key_id = '5f8b71fa0ba69ca886aa45643b6ce37e388320cb74670371b5590165c3f6a175' 
  AND (
    token = 'GG9ErRoVohjfGFoxrA8p8VLRUMMibMNZnSCKQBD8+8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034