UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9rLaj4PX10ZtxquOZn/p6aIsi3YAng2cO/BtJTpM/Ug=' 
WHERE 
  key_id = '39fdfe63bcce13728322ceb326c0f6925cffa198d5aa81854a2b09fb6d33b337' 
  AND (
    token = '9rLaj4PX10ZtxquOZn/p6aIsi3YAng2cO/BtJTpM/Ug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038