UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7V9VypZyaU0pWy0irec6r9n+pViM/B83TPHzieqvceo=' 
WHERE 
  key_id = 'd671285700ae59a60730def4dafbffa0f2ad35bade2ca779b93d631bfc463fa8' 
  AND (
    token = '7V9VypZyaU0pWy0irec6r9n+pViM/B83TPHzieqvceo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017