UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ize7d1WcNLjtrmf45Nx274Ze3vPYFuwQaqEiIN+nsb8=' 
WHERE 
  key_id = '3f5c45e9373ed0049424b01d4b6c4f8308a76fbe8ba3b790cc10791846f6e357' 
  AND (
    token = 'Ize7d1WcNLjtrmf45Nx274Ze3vPYFuwQaqEiIN+nsb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028