UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4i93tBQ0cjLt6QazGvlOncCExGtbA9Cr5TiuBOalRjM=' 
WHERE 
  key_id = '1125f2c15e7118a04f1d77f1b9dfd83c9b69c463f62b5ad03098072ec09b536a' 
  AND (
    token = '4i93tBQ0cjLt6QazGvlOncCExGtbA9Cr5TiuBOalRjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029