UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1WyXI6k7PhssyHFxt0FUFEth1laMppY5o8l7Oz9siGU=' 
WHERE 
  key_id = '2a5e55753fafc40ec0707c68e0f66f602271f997d615e399a5975481eaf60c86' 
  AND (
    token = '1WyXI6k7PhssyHFxt0FUFEth1laMppY5o8l7Oz9siGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019