UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xCZm6XdDj2NuWaONvdrH+RwS2GlymxthL5qmsmxPrOs=' 
WHERE 
  key_id = '74d6c554d9ddd5a1ef240ab62c855dd4f46e3c4170d55b83b0ae2cdefca523c4' 
  AND (
    token = 'xCZm6XdDj2NuWaONvdrH+RwS2GlymxthL5qmsmxPrOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026