UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3cnLRnMCbdyqepqwcZbzbJ9/4Ww+Sj7HYB6+MSgflBQ=' 
WHERE 
  key_id = 'dd2f96d839a67f784f616a7b0ad37cbd7c97e36dbd5f68d958476428ec6665a6' 
  AND (
    token = '3cnLRnMCbdyqepqwcZbzbJ9/4Ww+Sj7HYB6+MSgflBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047