UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bNfzVctE2w0zpukNj97OSghFhdz5ypts7/9QI7UH7WM=' 
WHERE 
  key_id = 'b8f3dca039d00430db3e3f61099db9375e169111466ec408319059460b5ae8e7' 
  AND (
    token = 'bNfzVctE2w0zpukNj97OSghFhdz5ypts7/9QI7UH7WM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042