UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'puFPBN/tOU+uz8s6u1FlxbarHEUTqqImp3ecGA8/EIM=' 
WHERE 
  key_id = 'a2f8db087228e48a93c5560513a83df8201d925883a111cad8d77aa09911e6bb' 
  AND (
    token = 'puFPBN/tOU+uz8s6u1FlxbarHEUTqqImp3ecGA8/EIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044