UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PAfR3R+70qfgJYD8T/V0JIOIs8EkWjmJqp51WIvFnaE=' 
WHERE 
  key_id = 'eb89b412ff18e435f0e85f2becb81f616e58af7b4bc22bf4289d1f3285ff96ba' 
  AND (
    token = 'PAfR3R+70qfgJYD8T/V0JIOIs8EkWjmJqp51WIvFnaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032