UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p2xek2erVCOZkg/rRkjwPREVjI1vHT+K/mg2ZArl+Fo=' 
WHERE 
  key_id = '329ab140dbfc89c4b8aa5fc9da8904bd15f8e212e3f8d76b4cd271c1080d5673' 
  AND (
    token = 'p2xek2erVCOZkg/rRkjwPREVjI1vHT+K/mg2ZArl+Fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034