UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CdXegUHdro23jRgPHUXFGF1FgvbmI8kzK+nGQ0o+2Mg=' 
WHERE 
  key_id = '68b18d17661fd7b2187f744b071cfd0dc6a80540304c11bc66585261fb643675' 
  AND (
    token = 'CdXegUHdro23jRgPHUXFGF1FgvbmI8kzK+nGQ0o+2Mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041