UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k5XIp5rv9F8HysTZZc+KdvoDy/m9C/SjRwzz+uqCVXg=' 
WHERE 
  key_id = '01b2658420281f46acd95ac488876869f41d6333e51c598b32e6dd64eac11b93' 
  AND (
    token = 'k5XIp5rv9F8HysTZZc+KdvoDy/m9C/SjRwzz+uqCVXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035