UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V2vkN+TmvMod3CE0j5pyKferAEU4m0HR+RhfIXCQCuw=' 
WHERE 
  key_id = '1541519d01c0cad2736868a55f084b83cf069825460c38f37ace566cbf86b3e8' 
  AND (
    token = 'V2vkN+TmvMod3CE0j5pyKferAEU4m0HR+RhfIXCQCuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026