UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o/pHjgqhnhM91shcZRLIwy69hTrEK9XbZZyMEEggdb4=' 
WHERE 
  key_id = '0c50388d105a4aece2f13222de16744a6b288ce30e22cb79347c2f03b8b3699d' 
  AND (
    token = 'o/pHjgqhnhM91shcZRLIwy69hTrEK9XbZZyMEEggdb4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025