UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gVy0B/OEjB1t5tn8sQFiQixMJsUhgFKXd0p4+qsQXfE=' 
WHERE 
  key_id = '7a6396470dd7d4627282fad4b8a1647404ba9c8b41584952c4d00eac888bc9c8' 
  AND (
    token = 'gVy0B/OEjB1t5tn8sQFiQixMJsUhgFKXd0p4+qsQXfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028