UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQxQDXSJ7+Ybd39NXtJdkK1qNJpyYLVaaspZ5GZcvFM=' 
WHERE 
  key_id = '1355b1efa8b66d93dd1ea182ac3342bb99dcda4d1dbd86841453b875b9b35667' 
  AND (
    token = 'KQxQDXSJ7+Ybd39NXtJdkK1qNJpyYLVaaspZ5GZcvFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044