UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ugSzH+qUpjmcluUuOfT/nx16a3St48WzM474LUz95Z8=' 
WHERE 
  key_id = 'a46ded5027674e1eea276f42d547ec57693a2f5ff66afdccb140c4a3bbdc849e' 
  AND (
    token = 'ugSzH+qUpjmcluUuOfT/nx16a3St48WzM474LUz95Z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030