UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E+UlD397rSsT3FmBNdCdbcBztot1mIMXdO/vxym3LsY=' 
WHERE 
  key_id = '6edb22347555cc3d983d792624f3e80316eae804968b03a3f409206f0542e2ed' 
  AND (
    token = 'E+UlD397rSsT3FmBNdCdbcBztot1mIMXdO/vxym3LsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036