UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lmXtbXB+RCSZvDHMyiZLiFmLHudP3MSWInyvViqNABI=' 
WHERE 
  key_id = '39ee6fbfa52b9809eb7aa1ea11b392a016f182358a6aeafbac8b9095d18f307c' 
  AND (
    token = 'lmXtbXB+RCSZvDHMyiZLiFmLHudP3MSWInyvViqNABI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044