UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H+ZEu0afLjzlJLMcgUWRVt+ZX9sbEZmoqCa4QFNKJi8=' 
WHERE 
  key_id = '5182f76ee8437bee3171b32d431277800ab23b42b9abd2e17cf69ee388ed7b51' 
  AND (
    token = 'H+ZEu0afLjzlJLMcgUWRVt+ZX9sbEZmoqCa4QFNKJi8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016