UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eKOIpQcz3VZii0YsSpZkrKbelkKVMc7HDcdP72Pp3lU=' 
WHERE 
  key_id = '24e9bbc3209f4fb23c5ae98af916871f0b285246da0770645c841e9eb45f5097' 
  AND (
    token = 'eKOIpQcz3VZii0YsSpZkrKbelkKVMc7HDcdP72Pp3lU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050