UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5RkVuPuO1WlnKFlrU+Ys4no8ZiulOuZLKUaTgEZ2X4M=' 
WHERE 
  key_id = '2a09ced8567b3f4e45813f23b37f7931f613012231dfc339615c1a69b014d140' 
  AND (
    token = '5RkVuPuO1WlnKFlrU+Ys4no8ZiulOuZLKUaTgEZ2X4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019