UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h17qWzmhsAaFdEudEA//HDd9p9U70Y21nNtx4RkNHig=' 
WHERE 
  key_id = '8a34e4e71f8dac083d772e80ea5df4b99b4ee6f14508a8c1146da1cf77ed9115' 
  AND (
    token = 'h17qWzmhsAaFdEudEA//HDd9p9U70Y21nNtx4RkNHig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032