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

Query time 0.00046