UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'INSNmPP/3Pfp29sex6oO15bYqvsZiiQCB98NdVeeY2Y=' 
WHERE 
  key_id = '339e4a2f765229e8e9a03959361ea9ba3543c79c5f0f29c3166494b1d083f044' 
  AND (
    token = 'INSNmPP/3Pfp29sex6oO15bYqvsZiiQCB98NdVeeY2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035