UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EtBd2tuXlDNfuscDts4mbNqWfPvBAOBHhas5O6EV5+0=' 
WHERE 
  key_id = '95d54d83e5fa7f930427b55f6d2fa634ce024c836b395fe6abd35775acc2a1aa' 
  AND (
    token = 'EtBd2tuXlDNfuscDts4mbNqWfPvBAOBHhas5O6EV5+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025