UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dCNv8OjjDRPn5IfiCK4k/W/K/1sB/mzIvkGJFtxUF7s=' 
WHERE 
  key_id = '5cb840219400863ad0caa2e4fa99efac84bf26e34b93dd1e2c0184c741458da1' 
  AND (
    token = 'dCNv8OjjDRPn5IfiCK4k/W/K/1sB/mzIvkGJFtxUF7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025