UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HVj5IAuCCa4K9mZOgsoWaTGCKPEzeJ/Sx3qshb/4Ncw=' 
WHERE 
  key_id = '58b88baafc94dfebdd3fb1642a6078a6566f524558031bedd9958ce296992869' 
  AND (
    token = 'HVj5IAuCCa4K9mZOgsoWaTGCKPEzeJ/Sx3qshb/4Ncw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044