UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ibpOzznYREgcl5Opu17uH9lwWl/HEc7TMRz5wmsC+nM=' 
WHERE 
  key_id = '04946e5ce9a889a86bc737a7cc2b0d3a437e6bba7ccdbabf84c918cb6b13a244' 
  AND (
    token = 'ibpOzznYREgcl5Opu17uH9lwWl/HEc7TMRz5wmsC+nM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046