UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fSopj5zM35612PVT1qXiHrYMyD1Xrd51IZBXa8p/0rE=' 
WHERE 
  key_id = 'ca891ce5a15b2f7b3d5bf72504fb16e9c4d8bde4c31b0732b4fdaf9a91637644' 
  AND (
    token = 'fSopj5zM35612PVT1qXiHrYMyD1Xrd51IZBXa8p/0rE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082