UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lzk+8kpxl4S+HGqjoaYVYIW67eoLbK7vZQtxVD/uWJc=' 
WHERE 
  key_id = '476d61393a4c6ebba348c5824de8fd69d8034bb4c19445a343494e136a736671' 
  AND (
    token = 'lzk+8kpxl4S+HGqjoaYVYIW67eoLbK7vZQtxVD/uWJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032