UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EhFZLZtiFAceXZHmNqZts6vhddn3RygSJc3zBeSKFns=' 
WHERE 
  key_id = '5a209d0dad153ad04fe2369192009c65255fcbc117771e683e9ae085d0e6c25f' 
  AND (
    token = 'EhFZLZtiFAceXZHmNqZts6vhddn3RygSJc3zBeSKFns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036