UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NtiOeHS8Cf+6iKMLCpMdJ99UiYRLTlsYHn1d7UmPiNc=' 
WHERE 
  key_id = '846b27b4f1395500724cba34019f914b30acc4fe7c7aaf58311a9f2881714c65' 
  AND (
    token = 'NtiOeHS8Cf+6iKMLCpMdJ99UiYRLTlsYHn1d7UmPiNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028