UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yK8wIQ9e7LeA5jYjGASGanCLCxUZS6CYMbXhyCPohLM=' 
WHERE 
  key_id = 'e80c5689cf727c7dc3c14797e971e8654b2cac70736e5dfa373635827b79014c' 
  AND (
    token = 'yK8wIQ9e7LeA5jYjGASGanCLCxUZS6CYMbXhyCPohLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034